package com.example.administrator.shzs.parse;

import com.alibaba.fastjson.JSON;
import com.example.administrator.shzs.entity.mSoRecycleview;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * 搜索下拉菜单  第一列 工具类
 * Created by Administrator on 2016/10/29.
 */

public class ParseSearchRecycleview {
    public static List<mSoRecycleview> getmSoRecycleview (String json){
        List<mSoRecycleview> list = new ArrayList<>();
        try {
            JSONObject jsonObject= new JSONObject(json);
            JSONArray array= jsonObject.getJSONArray("datalist");

            if(null != array && array.length()>0){

                for (int i = 0; i <array.length() ; i++) {

                list.add(JSON.parseObject(array.get(i).toString(),mSoRecycleview.class));
                }

            }

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }
}
